from redis import Redis

db_uri = 'mysql+pymysql://oldpan:whnb@localhost:3306/ihome'
redis_store = Redis(host='127.0.0.1', port=6379, db=3)


class Config:
    SECRET_KEY = 'a_girl_named_Tian_Tian'
    # database
    SQLALCHEMY_DATABASE_URI = db_uri
    SQLALCHEMY_TRACE_MODIFICATIONS = False
    # redis
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis_store
    PERMANENT_SESSION_LIFETIME = 3600  # 秒
    SESSION_PERMANENT = False
    SESSION_COOKIE_SECURE = True
    SESSION_USE_SIGNER = True
    # CSRF


class Development(Config):
    DEBUG = True
    ENV = 'development'


class Production(Config):
    DEBUG = False
    ENV = 'production'
